import 'package:flutter/material.dart';
import 'ai_shop_item.dart';

class AIShopItemDemo extends StatelessWidget {
  const AIShopItemDemo({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('订单商品示例'),
        backgroundColor: Colors.white,
        elevation: 0,
        titleTextStyle: TextStyle(
          color: Colors.black,
          fontSize: 18,
          fontWeight: FontWeight.bold,
        ),
      ),
      body: Container(
        color: Colors.grey[100],
        padding: EdgeInsets.all(8.0),
        child: ListView(
          children: [
            AIShopItem(
              orderTime: '2025-10-26 16:49:01',
              orderStatus: '待发货',
              productImage: 'assets/qiche.png', // 使用项目中已有的图片资源
              productName: '茶水分离杯耐热隔热玻璃杯，茶水分离杯耐热隔热玻璃杯，茶水分离杯耐热隔热玻璃杯',
              productSpec: '规格:白色240ml',
              price: '¥ 10.00',
              quantity: 2,
              totalPrice: '¥ 20.00',
              onPayPressed: () {
                // 处理支付按钮点击事件
                ScaffoldMessenger.of(context).showSnackBar(
                  SnackBar(content: Text('跳转到支付页面')),
                );
              },
            ),
            // 可以添加更多的订单商品项
            AIShopItem(
              orderTime: '2025-10-25 14:30:22',
              orderStatus: '已完成',
              productImage: 'assets/open_eyes.png',
              productName: '智能手表多功能运动监测防水计步器',
              productSpec: '规格:黑色 42mm',
              price: '¥ 299.00',
              quantity: 1,
              totalPrice: '¥ 299.00',
              onPayPressed: () {
                ScaffoldMessenger.of(context).showSnackBar(
                  SnackBar(content: Text('该订单已完成')),
                );
              },
            ),
          ],
        ),
      ),
    );
  }
}